﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace QuanLyThuNgan
{
    public class HoanTienDAO
    {
        public DataSet m_SelectBenhNhanHoanTien(HoanTienDTO _info)
        {
            string _sql = string.Format("exec usp_ThuNgan_HoanTien_SelectNhanBenh '{0}',{1},'{2}'", _info.SSohsTim, _info.ISTT, _info.SNgayKham);
            return Uit.it_SQL.getDataSet(_sql,false);
        }

        //Insert hoan tien master-----------------------
        public object m_Insert(HoanTienDTO _info)
        {
            string _sql = string.Format("usp_ThuNgan_HoanTienMst_Insert '{0}','{1}','{2}',{3},{4},{5},{6}", _info.SSobn, _info.SNgayHoan, _info.SGioHoan, _info.ILyDoHoan, _info.IIDCaHoan, _info.ITongTienHoan, _info.IIDHoanTien);
            return Uit.it_SQL.ExecuteScalar(_sql);
        }
        
        //insert hoan tien detail----------------------
        public bool m_InsertDtl(HoanTienDTO _info)
        {
            string _sql = string.Format("usp_ThuNgan_HoanTienDtl_Insert '{0}','{1}',{2},{3},{4}", _info.SSobn, _info.Sdvucode, _info.ITienHoan, _info.ISoLuongHoan,_info.IIDHoan);
            return Uit.it_SQL.ExecuteNonQuery(_sql, false);
        }

        //select ca thu ngan----------------------------
        public DataTable m_SelectHoanTienCaLamViec(HoanTienDTO _info)
        {
            string _sql = string.Format("usp_ThuNgan_HoanTienCaThuNgan_Select {0},'{1}'", _info.IIDHoanTien, _info.SNgayHoan);
            return Uit.it_SQL.getDataTable(_sql);
        }

        //update bHoantien nhan benh chi tiet---------
        public bool m_UpdateNhanBenhCT(HoanTienDTO _info)
        {
            string _sql = string.Format("usp_ThuNgan_HoanTien_UpdateNhanBenhCT {0}", _info.INhanBenhCT);
            return Uit.it_SQL.ExecuteNonQuery(_sql, false);
        }
        //select hoan tien bafee--------------------------
        public DataSet m_SelectHoanTienBafee(HoanTienDTO _info)
        {
            string _sql = string.Format("exec dbo.usp_ThuNgan_HoanTien_SelectBenhNhanBafee '{0}'", _info.SSobn);
            return Uit.it_SQL.getDataSet(_sql, false);
        }
    }
}
